﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BBPA.Admin.SYS.Category
{
    public partial class List : ListPage
    {
        BLL.Category bllList = new BLL.Category();
        BLL.Category bll = new BLL.Category();
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.show_info = false;
            Master.show_listControls = Master.show_formControls = true;
            int FatherCategoryID=DataTypePlus.requestInt(Request.QueryString["FatherCategoryID"]);
            Master.BasicSQL = " FatherCategoryID=" + FatherCategoryID;
            Master.QueryString="FatherCategoryID=" + FatherCategoryID;
        }
        public override void buildSQL_Page_List_search()
        {
            Master.SearchSQL = "";
        }
        public override DataSet get_Page_DataSet(string sql_, string orderby_, int pageFrom_, int pageTo_) { return bllList.GetListByPage(sql_, orderby_, pageFrom_, pageTo_); }
        public override void del_Page_List(string inStr_)
        {
            foreach (string id in inStr_.Split(','))
            {
                int thisID = DataTypePlus.requestInt(id);
                foreach (Model.Category category in bll.GetModelList("'|'+CategoryID_Tree like '%|" + thisID + "|%'"))
                {
                    bll.Delete(category.id);
                    BLL.User_Operate_Log.Add(Security.GetCurrentUserID(), EnumHelper.TableName.Category, category.id, EnumHelper.OperateType.Delete, "");
                }
                
            }
        }

    }
}